#!/bin/sh

turn_on()
{
	synclient TouchpadOff=0
	echo "Touchpad turned on"
}

turn_off()
{
	synclient TouchpadOff=1
	echo "Touchpad turned off"
}

is_on()
{
	[ "$(synclient -l | grep TouchpadOff | cut -d'=' -f2)" -eq 0 ]
}

if [ $# -eq 1 ]; then
	if [ "$1" = "1" -o "$1" = "on" -o "$1" = "true" -o "$1" = "yes" ]; then
		turn_on
	else
		turn_off
	fi
else
	is_on && turn_off || turn_on
fi
